/*
 * =====================================================================================
 *
 *       Filename:  check_stream.c
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  01/04/2009 03:15:51 PM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Dr. Fritz Mehner (mn), mehner@fh-swf.de
 *        Company:  FH Südwestfalen, Iserlohn
 *
 * =====================================================================================
 */

#include<stdio.h>

int main(void){
	//open  files 
	FILE *ts_stream;
	char *ts_location = "./test.ts";
	if ( NULL == (ts_stream = fopen(ts_location,"rb"))){
		printf("CAN'T open %s \n",ts_location);
		return 0;
	}
	FILE *fp_dbg;
	char *ts_dbg = "./debug.ts";
	int bytes_put;
	if ( NULL == (fp_dbg = fopen(ts_dbg,"rb"))){
		printf("CAN'T open %s \n",ts_dbg);
	}

	int c;
	unsigned long long cnt = 0;
	while (EOF != (c =fgetc(fp_dbg))){
		if (cnt == 0) printf("%c,%d,%x",c,c,c);
		cnt++;
		if (fgetc(ts_stream) != c){
			printf("TS is not completely the same:0x%llx\n",cnt);
			return(0);
		}
	}
	printf("byte num:%d\n",cnt);
	return(0);
}
